#include <stdio.h>
#include <math.h>

#define PARTITION 100000000

double integral(double b,double t,double (*f)(double)){
  double result = 0;
  double interval = (t-b)/PARTITION;
  for(int i = 0;i < PARTITION;i++){
    result += interval * f(b);
    b += interval;
  }

  return result;
}

double g(double x){
  return x;
}

int main()
{
  double top = 2;
  double bottom = -1;
  printf("%.10f\n",integral(bottom,top,sin));
  printf("%.10f\n",integral(bottom,top,g));
  printf("%.10f\n",integral(bottom,top,exp));
}
